<template>
  <div class="editprod">
    {{arr}}
    <table border="1" cellpadding="0" cellspacing="0" >
        <tr>
            <th>操作</th>
            <th>商品</th>
            <th>标题</th>
            <th>是否上架</th>
            <th>上架时间</th>
            <th>热度</th>
            <th>销售量</th>
            <th>访问量</th>
        </tr>
        <tbody v-for="(item,index) in index" :key="index">
            <tr>
                <td><input type="checkbox" :value="index+1" v-model="arr"></td>
                <td><img :src="item.imgURL" /></td>
                <td><input type="text" v-model="item.title"></td>
                <td v-if="item.grounding==true">上架</td>
                <td v-if="item.grounding==false">未上架</td>
                <td>{{`${new Date(item.createTime).getFullYear()}/${('0'+(new Date(item.createTime).getMonth()+1)).slice(-2)}/${('0'+(new Date(item.createTime).getDate())).slice(-2)}/${('0'+(new Date(item.createTime).getHours())).slice(-2)}:${ ('0'+(new Date(item.createTime).getMinutes())).slice(-2)}:${('0'+(new Date(item.createTime).getSeconds())).slice(-2)}`
    }}</td>
                <td><input type="text" v-model="item.hot"></td>
                <td><input type="text" v-model="item.sale"></td>
                <td><input type="text" v-model="item.visits"></td>
            </tr>

       
      </tbody>
     </table>
  </div>
</template>

<script>

import{mapMutations} from 'vuex';

import index from "../assets/JS/index.js";

export default {
name:'EditProd',
data(){
    return{
        index,
        arr:[]
    }
},
methods:{
    ...mapMutations(['ImgList']),

}
}
</script>

<style scoped>
.editprod table img{
 width: 100px;
 height: 80px;
}
.editprod table{
    width: 80%;
    height: 100%;
    text-align: center;
}
.editprod input{
    border: none;
    text-align: center;
   outline: none;
}
</style>